﻿using System;
using System.Runtime.Serialization;

namespace Crocodoc
{
    /// <summary>
    /// Represents the result of when a document is uploaded.
    /// </summary>
    [DataContract]
    public class UploadResult
    {
        /// <summary>
        /// Gets or sets the newly uploaded document's UUID. This should be persisted somewhere.
        /// </summary>
        [DataMember(Name = "uuid")]
        public string UUID
        {
            get;
            set;
        }

        /// <summary>
        /// The error message if an error happened
        /// </summary>
        [DataMember(Name = "error")]
        public string Error
        {
            get;
            set;
        }

        /// <summary>
        /// Gets whether or not there was an error while uploading.
        /// </summary>
        public bool HasError
        {
            get
            {
                return !String.IsNullOrEmpty(Error);
            }
        }
    }
}
